<?php

namespace app\api\controller\intelligentlive;

use app\api\service\intelligentlive\ProductService;
use think\Request;

class Product
{
    protected $Service;
    public function __construct()
    {
        $this->Service = ProductService::getInstance();
    }

    public function addProduct(Request $request)
    {
        $params = $request->post();
        $result = $this->Service->addProduct($params);
        return writeJson(200,$result,"新增成功");
    }

    public function upProduct(Request $request)
    {
        $params = $request->post();
        $result = $this->Service->upProduct($params);
        return writeJson(200,$result,"更新成功");
    }

    public function delProduct(Request $request)
    {
        $params = $request->post();
        $result = $this->Service->delProduct($params);
        return writeJson(200,$result,"删除成功");
    }

    public function productList(Request $request)
    {
        $params = $request->post();
        $result = $this->Service->productList($params);
        return writeJson(200,$result,"获取成功");
    }
}